Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sum of Absolute Differences Benchmark #22

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

bornaehsani
Copy link
Collaborator

To compare against the "SAD" testbench in the IMPACT Parboil benchmark.

Comment on lines +36 to +56
int __attribute__ ((noinline)) sum_abs_diff_single_work_per_tile (int *REF, int *FRAME, int *RES,
uint32_t ref_height, uint32_t ref_width,
uint32_t frame_height, uint32_t frame_width,
uint32_t res_height, uint32_t res_width) {

int start_y = __bsg_tile_group_id_y * bsg_tiles_Y + bsg_y;
int end_y = MIN (start_y + frame_height, res_height);
int start_x = __bsg_tile_group_id_x * bsg_tiles_X + bsg_x;
int end_x = MIN (start_x + frame_width, res_width);


int sad = 0;
for (int y = start_y; y < end_y; y ++) {
for (int x = start_x; x < end_x; x ++) {
sad += ABS ( (REF[y * ref_width + x] - FRAME[(y - start_y) * frame_width + (x - start_x)]) );
}
}

RES[start_y * res_width + start_x] = sad;
return 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said in the meeting - if you use templates for the input datatype you won't have binary bloat. I think it's worth your time to do this.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're worried about namespace collision you can do:

namespace v0{
// Kernel source

}

And then in the kernel.cpp file:

using namespace v0;

Comment on lines +31 to +34
/******************************************************************************/
/* Runs the sum ob absolute differences kernel between a reference and a */
/* frame image (represented by 3D RGB pixel matrixes) */
/******************************************************************************/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two comments:

  1. ob -> of
  2. The comment boxes are hard to maintain and add a lot of whitespace. Can you make them a single comment (i.e.
/******************************************************************************
 * Runs the sum ob absolute differences kernel between a reference and a
 * frame image (represented by 3D RGB pixel matrixes)
 ******************************************************************************/

or


// *****************************************************************************
// Runs the sum ob absolute differences kernel between a reference and a
// frame image (represented by 3D RGB pixel matrixes)
// *****************************************************************************

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants